﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls">

    <ControlTemplate x:Key="GlowTemplate" TargetType="{x:Type Controls:Glow}">
        <Grid Margin="{TemplateBinding Padding}" Background="Transparent">
            <Border Grid.Row="1" Grid.Column="1" Background="{TemplateBinding Background}" />
            <Border x:Name="glowSource" Grid.Row="1" Grid.Column="1" Margin="-1,0" Opacity="0.6" Background="{TemplateBinding Background}" >
                <Border.Effect>
                    <BlurEffect Radius="8" />
                </Border.Effect>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter TargetName="glowSource" Property="Margin" Value="0,-1" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Controls:Glow}">
        <Setter Property="Background">
            <Setter.Value>
                <SolidColorBrush Color="{Binding Path=GlowColor, RelativeSource={RelativeSource AncestorType={x:Type Controls:Glow}} }"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Width" Value="1" />
        <Setter Property="Padding" Value="0,8" />
        <Setter Property="Template" Value="{StaticResource GlowTemplate}" />
        <Style.Triggers>
            <Trigger Property="IsGlow" Value="False">
                <Setter Property="Background" Value="Transparent" />
            </Trigger>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto" />
                <Setter Property="Height" Value="1" />
                <Setter Property="Padding" Value="0" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>